<template>
	<view class="container">

		<view>
			<u-search placeholder="输入订单号进行搜索" :showAction="true" actionText="搜索" :animation="false"></u-search>
		</view>



		<view class="order-list">
			<text style="font-size: 16px;">共3条</text>
			<view class="order-item" v-for="order in orders" :key="order.id">
				<view class="order-header">
					<text style="font-size: 18px;">订单号: {{ order.id }}</text>
					<text class="amount">{{ order.amount }}元</text>
				</view>
				<view class="order-details">
					<text class="detail-text">下单用户: {{ order.user }}</text>
					<text class="detail-text">预约时间: {{ order.time }}</text>
					<text class="detail-text">服务项目: {{ order.service }}</text>
				</view>
				<view class="order-bottom">
					<text class="detail-text">下单时间: {{ order.time }}</text>
					<button class="details-button" @click="goTodetail">查看详情</button>
				</view>

			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				orders: [{
						id: '20221010831213',
						user: '张三丰',
						time: '2022-10-10 11:00',
						service: '发动机清洗换油、清洁车厢、汽车美容',
						amount: '2000.00'
					},
					{
						id: '20221010831214',
						user: '张三丰',
						time: '2022-10-10 11:00',
						service: '发动机清洗换油、清洁车厢、汽车美容',
						amount: '2000.00'
					},
					{
						id: '20221010831215',
						user: '张三丰',
						time: '2022-10-10 11:00',
						service: '发动机清洗换油、清洁车厢、汽车美容',
						amount: '2000.00'
					}
				]
			};
		},
		methods: {
			goTodetail() {
				uni.navigateTo({
					// url: listItem.page
					url: '/pages/order/orderdetail/orderdetail'
				})
				// this.$router.push('/pages/order/orderdetail/orderdetail')
			}
		}

	};
</script>

<style>
	.container {
		padding: 20px;
	}

	.search-bar {
		display: flex;
		justify-content: space-between;
		margin-bottom: 20px;
	}

	.search-bar input {
		flex: 1;
		margin-right: 10px;
		padding: 10px;
		border: 1px solid #ccc;
		border-radius: 4px;
	}

	.search-bar button {
		padding: 10px 20px;
		background-color: #007aff;
		color: #fff;
		border: none;
		border-radius: 4px;
	}

	.order-list {
		margin-top: 30px;
	}

	.order-item {
		border: 1px solid #ccc;
		border-radius: 4px;
		padding: 10px;
		margin-top: 10px;
		margin-bottom: 16px;
	}

	.order-header {
		display: flex;
		justify-content: space-between;
		margin-bottom: 10px;
		font-weight: bold;
	}

	.amount {
		color: red;
	}

	.order-details {
		display: flex;
		flex-direction: column;
		margin-bottom: 10px;
	}

	.detail-text {
		margin-bottom: 5px;
	}

	.order-bottom {
		border-top: 1px #c3c0bb solid;
		padding-top: 10px;
		display: flex;
		/* flex-direction: row; */
		justify-content: space-around;
		align-items: center;
		font-size: 12px;
		color: #ccc;
	}

	.details-button {
		/* padding: 10px; */
		background-color: #557AD6;
		color: #fff;
		border: none;
		border-radius: 4px;
		width: 40%;
		height: 30px;
		line-height: 30px;
		margin-left: 20px;
	}
</style>